package com.client.job.core.config;

import javax.annotation.Resource;

import org.springframework.context.annotation.Configuration;
import org.springframework.core.annotation.Order;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.SchedulingConfigurer;
import org.springframework.scheduling.config.ScheduledTaskRegistrar;


/**
 * 任务注册
 *
 * @author mengxiangzhong
 * @des
 * @date 2021年8月31日
 */
@Configuration
@EnableScheduling
@Order(0)
public class CompleteScheduleConfig implements SchedulingConfigurer {


    @Resource
    private TaskRegisterCompent taskRegisterCompent;

    /**
     * 执行定时任务.
     */
    @Override
    public void configureTasks(ScheduledTaskRegistrar taskRegistrar) {
        taskRegisterCompent.initSocketCollect();
        try {
            taskRegisterCompent.scanTasksAndSendTask();
        } catch (Exception e) {
            e.printStackTrace();
            throw new RuntimeException(e.getMessage());
        }

    }


}
